|
[ Intro ] [ Lesson1 ] [ Lesson2 ] [ Lesson3 ] [ Lesson4 ] [ Lesson5 ] [ Lesson6 ] [ Lesson7 ] [ Lesson8 ] |
||||||||||||
|
Let us examine some more advanced functions with combinations of if ( ) and while ( )
Now, what does really happen here? First of all, the program understands that you are about to turn something around the y-axis. In this case, the turret. It also understands that you want to turn 40 degrees with the speed of 150 degrees per second. That's it, yep it's that simple. If you want to turn the piece in the other direction, set a minus sign in front of the desired angle.
If we want to move stuff back and forth, we have to use another order. We tell the script that we want to move the barrel -5 points (which is 5 points back, into the turret) with the speed of 15 points per second. In short, this action simulates recoil.
One thing about those commands though: As soon as the engine hits the next command, it will execute it as well, so the animation shown above will not work because it will start moving to a position and then instantly starting to move back. So... what if you want to animate a cue set of orders? Well, there is a specifically designed command to force the program to wait for the animation to complete:
It's easy to understand what this line does. The barrel will now be thrown back and then slowly restore to it's original position. You can see this effect in working of you look at any TA unit that uses plasma cannons. All tanks, Big Berthas, Intimidators, Punishers and Guardians have different variations of this script. The equivalent for turning parts looks like this:
It is very important to keep track of the correct axis and wherever you are moving along or turning around the piece.
Congratulations, if you mastered this part, you can continue reading Lesson 3. |
||||||||||||
| Storm | ||||||||||||